package com.um.jdy.app.shop.factory;


import com.um.jdy.app.shop.entity.bo.AddressBO;
import com.um.jdy.app.shop.entity.bo.GoodsBO;
import com.um.jdy.app.shop.entity.bo.OrderBO;
import com.um.jdy.app.shop.entity.dto.ConfirmGoodsDTO;
import com.um.jdy.app.shop.entity.vo.CreateOrderVO;
import com.um.jdy.common.member.enums.PayEnum;
import com.um.jdy.common.shop.enums.OrderEnum;
import com.um.springboot.starter.exception.BusinessException;

import java.util.List;

/**
 * 订单工厂
 *
 * @author 邓南辉
 * 日期 2021/6/26
 * 版权所有 广州优匠科技有限公司
 */
public interface OrderFactory {

    /**
     * 生成待支付订单
     * @param goodsBOList
     * @param addressBO
     * @param activityCouponsId
     * @param type
     * @return
     */
    OrderBO confirmOrder(List<GoodsBO> goodsBOList, AddressBO addressBO, String activityCouponsId, String activityCouponsGiftId, OrderEnum.Type type);

    /**
     * 生成拼团待支付订单
     * @param goodsBOList
     * @param addressBO
     * @param activityCouponsId
     * @param marketGroupId
     * @return
     */
    OrderBO confirmGroupOrder(List<GoodsBO> goodsBOList, AddressBO addressBO, String activityCouponsId, String activityCouponsGiftId, String marketGroupId);

    /**
     * 支付订单
     * @param goodsBOList
     * @param addressBO
     * @param activityCouponsId
     * @param remark
     * @return
     */
    CreateOrderVO createOrder(List<GoodsBO> goodsBOList, AddressBO addressBO, String activityCouponsId, String activityCouponsGiftId, String remark, PayEnum.PayWay payWay);

    /**
     * 支付拼团订单
     * @param goodsBOList
     * @param addressBO
     * @param activityCouponsId
     * @param marketGroupId
     * @param remark
     * @return
     */
    CreateOrderVO createGroupOrder(List<GoodsBO> goodsBOList, AddressBO addressBO, String activityCouponsId, String activityCouponsGiftId, String marketGroupId, String remark, PayEnum.PayWay payWay);

    /**
     * 初始化订单列表，获取原价、商品基本信息
     * @param mallGoodsId
     * @param mallGoodsOptionId
     * @param num
     * @return
     */
    List<GoodsBO> initGoodsList(String mallGoodsId, String mallGoodsOptionId, Integer num);

    /**
     * 初始化订单列表，获取原价、商品基本信息
     * @param goodsList
     */
    List<GoodsBO> initGoodsList(List<ConfirmGoodsDTO> goodsList);


    /**
     * 获取收货地址，空为默认收货地址
     * @param accountAddressId
     * @return
     */
    AddressBO getAddress(String accountAddressId);

    /**
     * 计算订单运费
     * @param addressBO
     * @param goodsBOList
     * @return
     */
    Double calcOrderFreight(AddressBO addressBO, List<GoodsBO> goodsBOList) throws BusinessException;

}
